/**
 * 
 */
package com.vastcm.stuhealth.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 		yangyihao
 * @email		yyh2001@gmail.com
 * @date   		2013-1-13
 * @description	Encapsulate spring's ApplicationContext class for convenient.
 * @history		2013-1-13		Create.
 *
 */
public class AppContext { 

    private static ApplicationContext ctx;
	
    private AppContext() {
    }
	
    public static <T> T getBean(String objName, Class<T> classType) {
	if(ctx == null) {
            ctx = new ClassPathXmlApplicationContext("beans.xml");
        }
		
	return ctx.getBean(objName, classType);
    }

}
